#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QMdiArea>
#include <QAction>
#include <QToolBar>
#include <QStatusBar>
#include <QMenu>
#include <QMenuBar>
#include <QWorkspace>
#include <QSettings>
#include "parameterdockwidget.h"
#include "spectrumview.h"
#include "commonoptionstablemodel.h"

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget* parent = 0);
protected:
    void closeEvent(QCloseEvent* event);
private:
    void createActions();
    void createMenus();
    void createToolBar();
    void createStatusBar();
    void createDockWindows();
    void readSettings();
    void writeSettings();

    SpectrumView* activeSpectrumView() const ;
    SpectrumView* findSpectrumView(const QString& fileName) const;

    QSettings* settings;

    QWorkspace* workspace;
    QSignalMapper* windowMapper;
    ParameterDockWidget* parameterDockWidget;
    CommonOptionsTableModel* model;

    QMenu *fileMenu;
    QMenu *editMenu;
    QMenu *optionsMenu;
    QMenu *windowMenu;
    QMenu *helpMenu;
    QToolBar *toolBar;
    QAction *newAction;
    QAction *openAction;
    QAction *saveAction;
    QAction *exitAction;
    QAction *copyAction;
    QAction *distractAction;
    QAction *aboutAction;
    QAction *colorAction;
    QAction *pdfAction;
    QAction *closeAction;
    QAction *closeAllAction;
    QAction *tileAction;
    QAction *cascadeAction;
    QAction *arrangeAction;
    QAction *nextAction;
    QAction *previousAction;
    QAction *separatorAction;
private slots:
    SpectrumView* createSpectrumView();
    void slotOpen();
    void slotSaveAs() const;
    void slotCopy() const;
    void slotDistract();
    void slotAbout();
    void slotUpdate(QWidget*);
    void slotChangeColor();
    void slotSetBackgroundColor(const QColor&);
    void slotToPdf() const;
    void slotUpdateMenus();
    void slotUpdateWindowMenu();
};

#endif // MAINWINDOW_H
